package com.shenchuangit.webprintclient.printer;

import java.awt.print.PageFormat;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;

public class PrinterClient {
    public static void main(String[] args) {
        //获取打印服务对象
        PrinterJob job = PrinterJob.getPrinterJob();
        PageFormat pageFormat = job.defaultPage();//得到默认页格式
        job.setPrintable(new PngPrinter());//设置打印类

        try {
            //可以用printDialog显示打印对话框，在用户确认后打印；也可以直接打印
            //boolean a=job.printDialog();
            //if(a)
            //{

            job.print();
            //}
        } catch (PrinterException e) {
            e.printStackTrace();
        }
    }
}
